package cn.jb698.codec.msm.zcodec.demo;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class CodecPropertiesUtils {

	static Properties configProperties = new Properties();
	
	public static String propKey_driverClassName = "spring.datasource.driver-class-name";
	public static String propKey_url = "spring.datasource.url";
	public static String propKey_username = "spring.datasource.username";
	public static String propKey_password = "spring.datasource.password";

	static {
		String[] propFiles = { "/application-env_dev.properties" 
				,"/application-dev.properties" 
		};
		for (String propFile : propFiles) {
			try {
				InputStream propFileIs = Object.class.getResourceAsStream(propFile);
				if (propFileIs != null) {
					configProperties.load(propFileIs);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

	public static String getPropVal(String propKey) {
		String rtVal = null ;
		rtVal = configProperties.getProperty(propKey);
		return rtVal ;
	}
	
	
	public static void main(String[] args) {
		String propVal = getPropVal(propKey_url);
		System.err.println(propVal);
	}


}
